# ---接口测试相关地址---
# sit环境 主入口url
IP_SIT = "https://sys-sit.newpearl.com"
# uat环境 主入口url
IP_UAT = "https://sys-uat.newpearl.com"
# 登录 url
LOGIN_URL = "/api/user/mis/login.do"
# 物料主档查询
SEARCH_MATERIAL_SEARCH_URL = "/api/scm/auth/np/npMatDetail/list.do"
# 供应商档案查询
SUPPLIER_SEARCH_URL = "/api/scm/auth/np/npSupplier/list.do"
# 物料编码申请查询
MATERIAL_CODE_APPLY_SEARCH_URL = "/api/scm/auth/np/npMatCodeApplyH/list.do"
# 物料主档处理查询
MATERIAL_DEAL_BILL_SEARCH_URL = "/api/scm/auth/np/npMatDealBill/list.do"
# 采购合同查询
PURCHASE_CONTRACT_SEARCH_URL = "/api/scm/auth/scm/scmPurchaseContractH/list.do"
# 合同变更单查询
PURCHASE_CONTRACT_CHANGE_SEARCH_URL = (
    "/api/scm/auth/scm/scmPurchaseContractChangeH/list.do"
)
# 合同明细查询
PURCHASE_CONTRACT_DETAIL_SEARCH_URL = (
    "/api/scm/auth/scm/scmPurchaseContractD/detailList.do"
)
# 待处理请求查询
PURCHASE_APPLY_DETAIL_SEARCH_URL = "/api/scm/auth/scm/scmPurchaseApplyH/waitList.do"
# 采购订单查询
PURCHASE_ORDER_SEARCH_URL = "/api/scm/auth/scm/scmPoH/list.do"
# 订单跟进查询
PURCHASE_ORDER_DETAIL_SEARCH_URL = "/api/scm/auth/scm/scmPoD/detailList.do"
# 询报价处理-待报价明细查询
WAIT_QUOTE_LIST_SEARCH_URL = "/api/scm/auth/scm/scmPurchaseApplyH/waitQuoteList.do"
# 询报价处理-比价初审明细查询
ENQUIRY_PRICE_BILL_SEARCH_URL = "/api/scm/auth/scm/scmEnquiryPriceBill/search.do"
# 比价处理查询
ENQUIRY_PRICE_BILL_DEAL_SEARCH_URL = "/api/scm/auth/scm/scmEnquiryPriceBill/listPager"
# 招标大厅查询
BID_TENDER_SEARCH_URL = "/api/scm/auth/bid/bidTender/list"
# 待发货订单查询
BACKLOG_ORDER_SEARCH_URL = "/api/scm/auth/scm/scmPoD/detailListEx"
# 发货单查询
PU_INVOICE_LIST_SEARCH_URL = "/api/b2b/auth/pu/puInvoiceH/list.do"
# 供应商档案处理单据查询
SUPPLIER_BILL_SEARCH = "/api/scm/auth/np/npSupplierBill/list"

# --- 物料主档 ---
# 状态变更
CHANGE_MATERIAL_STATUS_URL = "/api/scm/auth/np/npMatStatusLog/statusChange.do"

# --- 物料编号申请 ---
# 删除物料编码申请单
DELETE_MAT_CODE_APPLY_URL = "/api/scm/auth/np/npMatCodeApplyH/remove.do"

# --- 供应商档案处理 ---
# 删除供应商档案处理单据
DELETE_SUPPLIER_BILL_URL = "/api/scm/auth/np/npSupplierBill/invalid.do"

# --- 采购合同 ---
# 批量删除采购合同
DELETE_PURCHASE_CONTRACT_URL = "/api/scm/auth/scm/scmPurchaseContractH/remove.do"
# 采购合同审批-退回/审核不通过
UPDATE_CONTRACT_STATUS_URL = (
    "/api/scm/auth/scm/scmPurchaseContractH/updateContractStatus.do"
)

# --- 申购单 ---
# 删除申购单
REMOVE_PURCHASE_APPLY_URL = "/api/scm/auth/scm/scmPurchaseApplyH/remove"
# 更新申购单状态
UPDATE_PC_APPLY_STATUS_URL = "/api/scm/auth/scm/scmPurchaseApplyH/updateStatus.do"

# --- 待处理请求 ---
# 采购关闭
CLOSE_PC_APPLY_URL = "/api/scm/auth/scm/scmPurchaseApply/close"

# --- SQL语句 ---
# 查询草稿状态的申购单的 id
DRAFT_PC_APPLY_ID_SQL = (
    "SELECT id FROM scm_purchase_apply_h WHERE status='Draft' LIMIT 1;"
)
# 查询状态为已提交待采购，并且物料种类为五金 的申购单号
COMMITTED_AND_W_PC_APPLY_ID_SQL = (
    "SELECT order_no FROM scm_purchase_apply_h "
    "WHERE status='WaitPurchase' AND mat_type_code='W' LIMIT 1;"
)
# 查询申购状态为 已提交待采购，询价进度为 未活跃 的申购明细
SQL001 = (
    "SELECT id FROM scm_purchase_apply_b "
    "WHERE details_status='WaitPurchase' "
    "AND inquiry_progress = 'inactive' LIMIT 1;"
)
